﻿<%@ Page Language="C#" MasterPageFile="~/master.Master" AutoEventWireup="true" ValidateRequest="false" CodeBehind="CaseStudyInfoDetail.aspx.cs"
    Inherits="CaseStudy.AdminPortal.CaseStudyInfoDetail" %>

<%@ Register Src="~/UserControl/LoginInfo.ascx" TagName="LoginInfo" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <uc1:LoginInfo ID="loginInfo" runat="server" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <div class="SiteMap">
        <div class="MapItem">
            <a href="Default.aspx" target="_self">首页</a></div>
        <div class="MapItem">/</div>
        <div class="MapItem">
            <a href="CaseStudyManager.aspx" target="_self">成功案例信息管理</a></div>
        <div class="MapItem">/</div>
        <div class="CurrentMapItem" id="currentMapItem" runat="server"></div>
    </div>
    <div class="CaseStudyDetailContent">
        <div class="CaseStudyTitle">成功案例信息：</div>
        <div id="divReminding" class="Reminding" runat="server" visible="false"></div>
        <div class="CaseStudyBody">
            <div class="InfoItem">
                <div class="ItemText">标题：</div>
                <div class="ItemInput">
                    <asp:TextBox ID="txtTitle" runat="server" Width="244px" />
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">描述：</div>
                <div class="ItemInput">
                    <asp:TextBox ID="txtDescription" runat="server" Width="244px" Rows="5" 
                        TextMode="MultiLine" />
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">文件名称：</div>
                <div class="ItemInput">
                    <asp:TextBox ID="txtFileName" runat="server" Width="244px" />
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">图片：</div>
                <div class="ItemInput">
                    <asp:FileUpload ID="loadImage" runat="server" Width="250px"  />
                </div>
            </div>
            <div class="InfoItem" id="divImage" runat="server" visible="false">
                <div class="ItemText"></div>
                <div class="ItemInput">
                    <asp:Image ID="imgShow" runat="server" Visible="false" />
                    <asp:Label ID="lblImageName" runat="server" Visible="false"></asp:Label>
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">技术类型：</div>
                <div class="ItemInput">
                    <div class="ControlDiv">
                        <a href="#" id="btnTechnology" class="ChooseTechnology" rel="#promptTechnology" onclick="CallPop('<%= hiddenTechChosen.ClientID %>', 'TechCss')">选择技术类型</a>
                    </div>
                    <div id="technologyChosen" class="technologyChosen"></div>
                    <asp:HiddenField ID="defaultTechnology" runat="server" Value='' />
                    <asp:HiddenField ID="hiddenTechChosen" runat="server" Value='' />
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">行业类型：</div>
                <div class="ItemInput" id="industryDropDownList">
                    <asp:DropDownList ID="ddIndustry" runat="server" Width="250px" Height="22px">
                    </asp:DropDownList>
                </div>
                <div class="ItemInput Hidden" id="industryTextBox">
                    <asp:TextBox ID="txtIndustry" runat="server" Width="244"></asp:TextBox>
                </div>
            </div>
            <div class="InfoItem" id="exIndustry">
                <div class="ItemText"></div>
                <div class="ItemInput">
                    <a href="javascript:void(0);" id="btnIndustry" onclick="Turn('industryDropDownList', 'industryTextBox', 'btnIndustry', '<%=hiddenIndustry.ClientID %>', '技术类型');">新建技术类型</a>
                </div>
                <asp:HiddenField ID="hiddenIndustry" runat="server" Value='0' />
            </div>
            <div class="InfoItem">
                <div class="ItemText">客户名称：</div>
                <div class="ItemInput" id="clientDropDownList">
                    <asp:DropDownList ID="ddClient" runat="server" Width="250" Height="22px">
                    </asp:DropDownList>
                </div>
                <div class="ItemInput Hidden" id="clientTextBox">
                    <asp:TextBox ID="txtClient" runat="server" Width="244"></asp:TextBox>
                </div>
            </div>
            <div class="InfoItem" id="exClient">
                <div class="ItemText"></div>
                <div class="ItemInput">
                    <a href="javascript:void(0);" id="btnClient" onclick="Turn('clientDropDownList', 'clientTextBox', 'btnClient', '<%=hiddenClient.ClientID %>', '客户名称');">新建客户名称</a>
                </div>
                <asp:HiddenField ID="hiddenClient" runat="server" Value='0' />
            </div>
            <div class="InfoItem">
                <div class="ItemText">服务类型：</div>
                <div class="ItemInput" id="serviceDropDownList">
                    <asp:DropDownList ID="ddService" runat="server" Width="250px" Height="22px">
                    </asp:DropDownList>
                </div>
                <div class="ItemInput Hidden" id="serviceTextBox">
                    <asp:TextBox ID="txtService" runat="server" Width="244"></asp:TextBox>
                </div>
            </div>
            <div class="InfoItem" id="exService">
                <div class="ItemText"></div>
                <div class="ItemInput">
                    <a href="javascript:void(0);" id="btnService" onclick="Turn('serviceDropDownList', 'serviceTextBox', 'btnService', '<%=hiddenService.ClientID %>', '服务类型');">新建服务类型</a>
                </div>
                <asp:HiddenField ID="hiddenService" runat="server" Value='0' />
            </div>
            <div class="InfoItem">
                <div class="ItemText">性能：</div>
                <div class="ItemInput">
                    <asp:TextBox ID="txtCapability" runat="server" Width="244px" />
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">引述：</div>
                <div class="ItemInput">
                    <asp:TextBox ID="txtQuote" runat="server" Width="244px" />
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">位置：</div>
                <div class="ItemInput">
                    <asp:TextBox ID="txtLocation" runat="server" Width="244px" />
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">组织规模：</div>
                <div class="ItemInput">
                    <asp:TextBox ID="txtOrganizationSize" runat="server" Width="244px" />
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">组织说明：</div>
                <div class="ItemInput">
                    <asp:TextBox ID="txtOrganizationProfile" runat="server" Width="244px" Rows="5" TextMode="MultiLine" />
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">国家 / 地区：</div>
                <div class="ItemInput">
                    <asp:TextBox ID="txtCountry" runat="server" Width="244px" />
                </div>
            </div>
            <div class="InfoItem">
                <div class="ItemText">相关信息：</div>
                <div class="ItemInput">
                    <div class="ControlDiv">
                        <a href="#" id="btnRelated" class="ChooseRelated" rel="#promptRelated" onclick="CallPop('<%= hiddenRelChosen.ClientID %>', 'RelCss')">选择相关信息</a>
                    </div>
                    <div id="relatedGlobal" class="RelatedChosen"></div>
                    <div id="relatedChosen" class="RelatedChosen"></div>
                    <asp:HiddenField ID="globalRelated" runat="server" Value='' />
                    <asp:HiddenField ID="defaultRelated" runat="server" Value='' />
                    <asp:HiddenField ID="hiddenRelChosen" runat="server" Value='' />
                </div>
            </div>
            <div class="ItemButtons">
                <div class="ItemButton">
                    <asp:ImageButton ID="imgBtnConfirm" runat="server" ImageUrl="images/Button_Confirm.png"
                        OnClick="imgBtnConfirm_Click" />
                </div>
                <div class="ItemButton">
                    <asp:ImageButton ID="imgBtnReset" runat="server" CausesValidation="false" ImageUrl="images/Button_Reset.png"
                        OnClick="imgBtnReset_Click" />
                </div>
                <div class="ItemButton">
                    <asp:ImageButton ID="imgBtnReturn" runat="server" CausesValidation="false" ImageUrl="images/Button_Return.png"
                        OnClick="imgBtnReturn_Click" />
                </div>
            </div>
        </div>

        <div class="ChooseContent" id="promptTechnology">
            <div class="ChooseRelatedTitle">技术类型信息：</div>
            <div class="ChooseRelatedBody">
                <asp:Table ID="tblTechnology" runat="server">
                </asp:Table>
                <div class="ItemButtons">
                    <div class="ItemButton">
                        <input id="techConfirm" class="btnConfirm" type="button" />
                    </div>
                    <div class="ItemButton">
                        <input id="techCancel" class="btnCancel close" type="button" />
                    </div>
                </div>
            </div>
        </div>

        <div class="ChooseContent" id="promptRelated">
            <div class="ChooseRelatedTitle">相关信息：</div>
            <div class="ChooseRelatedBody">
                <asp:Table ID="tblRelatedGlobal" runat="server">
                </asp:Table>
                <hr />
                <asp:Table ID="tblRelated" runat="server">
                </asp:Table>
                <div class="ItemButtons">
                    <div class="ItemButton">
                        <input id="relatedConfirm" class="btnConfirm" type="button" />
                    </div>
                    <div class="ItemButton">
                        <input id="relatedCancel" class="btnCancel close" type="button" />
                    </div>
                </div>
            </div>
        </div>

    </div>

    <script type="text/javascript">
        $(document).ready(function () {

            var Requset = new Object();
            Requset = GetRequest();
            var mode = Requset['mode'];
            if (mode == "view") {
                document.getElementById('exIndustry').style.display = "none";
                document.getElementById('exClient').style.display = "none";
                document.getElementById('exService').style.display = "none";
                document.getElementById('techConfirm').style.display = "none";
                document.getElementById('relatedConfirm').style.display = "none";
            }

            var divTechChosen = document.getElementById("technologyChosen");

            var technologysDefault = document.getElementById("<%= defaultTechnology.ClientID %>").value;
            var technologys = technologysDefault.split(",");

            for (var i = 0; i < technologys.length; i++) {
                if (technologys[i] != "") {
                    var technology = document.createElement('div');
                    technology.innerHTML = technologys[i];
                    technology.className = "ChosenItemText";

                    divTechChosen.appendChild(technology);
                }
            }

            var divRelatedGlobal = document.getElementById("relatedGlobal");

            var relatedsGlobal = document.getElementById("<%= globalRelated.ClientID %>").value;
            var gRealteds = relatedsGlobal.split(",");

            for (var i = 0; i < gRealteds.length; i++) {
                if (gRealteds[i] != "") {
                    var realted = document.createElement('div');
                    realted.innerHTML = gRealteds[i];
                    realted.className = "ChosenItemText";

                    divRelatedGlobal.appendChild(realted);
                }
            }

            var divRelatedChosen = document.getElementById("relatedChosen");

            var relatedsDefault = document.getElementById("<%= defaultRelated.ClientID %>").value;
            var realteds = relatedsDefault.split(",");

            for (var i = 0; i < realteds.length; i++) {
                if (realteds[i] != "") {
                    var realted = document.createElement('div');
                    realted.innerHTML = realteds[i];
                    realted.className = "ChosenItemText";

                    divRelatedChosen.appendChild(realted);
                }
            }

            var triggersTechnology = $("#btnTechnology").overlay({

                // some mask tweaks suitable for modal dialogs
                mask: {
                    color: '#ebecff',
                    loadSpeed: 200,
                    opacity: 0.9
                },

                closeOnClick: false
            });

            var triggersRelated = $("#btnRelated").overlay({

                // some mask tweaks suitable for modal dialogs
                mask: {
                    color: '#ebecff',
                    loadSpeed: 200,
                    opacity: 0.9
                },

                closeOnClick: false
            });

            $("#techConfirm").bind("click", function (e) {
                // close the overlay
                triggersTechnology.eq(0).overlay().close();

                //var divTechChosen = document.getElementById("technologyChosen");
                var divs = divTechChosen.getElementsByTagName("div");
                for (var i = divs.length; i > 0; i--) {
                    var v = divs[i - 1];
                    divTechChosen.removeChild(v);
                }

                var lblTech = document.getElementById('<%= hiddenTechChosen.ClientID %>');
                lblTech.value = "";
                $("input:checked").each(function (index, domEle) {
                    if (domEle.parentElement.className == "TechCss") {

                        var technology = document.createElement('div');
                        technology.innerHTML = domEle.parentElement.title;
                        technology.className = "ChosenItemText";

                        divTechChosen.appendChild(technology);

                        var clientId = domEle.id;
                        var index = clientId.lastIndexOf('_') + 1;
                        var id = clientId.substring(index);
                        lblTech.value += id + ";"
                    }
                });

                // do not submit the form
                return e.preventDefault();
            });

            $("#relatedConfirm").bind("click", function (e) {
                // close the overlay
                triggersRelated.eq(0).overlay().close();

                //var divRelatedChosen = document.getElementById("relatedChosen");
                var divs = divRelatedChosen.getElementsByTagName("div");
                for (var i = divs.length; i > 0; i--) {
                    var v = divs[i - 1];
                    divRelatedChosen.removeChild(v);
                }

                var lblRelated = document.getElementById('<%= hiddenRelChosen.ClientID %>');
                lblRelated.value = "";
                $("input:checked").each(function (index, domEle) {
                    if (domEle.parentElement.className == "RelCss") {
                        var related = document.createElement('div');
                        related.innerHTML = domEle.parentElement.title;
                        related.className = "ChosenItemText";

                        divRelatedChosen.appendChild(related);

                        var clientId = domEle.id;
                        var index = clientId.lastIndexOf('_') + 1;
                        var id = clientId.substring(index);
                        lblRelated.value += id + ";"
                    }
                });

                // do not submit the form
                return e.preventDefault();
            });
        });
    </script> 
</asp:Content>
